﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chat
{
    /// <summary>
    /// UserOverviewItem.xaml 的交互逻辑
    /// </summary>
    public partial class UserOverviewItem : UserControl
    {
        public string Source {set{ control_Face.ImageSource = new BitmapImage(new Uri(value, UriKind.Relative)); } }
        public string UserName { get => control_Username.Text; set => control_Username.Text = value; }
        public bool isOnline { set { control_IsOnline.Visibility = value ? Visibility.Visible : Visibility.Hidden; } }
        public UserOverviewItem()
        {
            InitializeComponent();
        }
        public void AddMessage(ICU.Message message)
        {
            control_LatestMessage.Text = message.msg[10..] + "...";
            control_MessageCount.Text = (Convert.ToInt64(control_MessageCount.Text) + 1).ToString();
        }
    }
}
